/*

 * @(#)SimpleTRow.java

 */

package com.stony.poie.basic;

/**
 * A SimpleTRow is a XlsTRow contents an array of XlsTData.
 * <p>
 * Last modified: February 13, 2006
 * 
 * @author Thomas Wu
 * @version 1.0.0
 */

public final class SimpleTRow implements XlsTRow {

	/* Contents of the SimpleTRow. */

	private XlsTData[] data;

	/**
	 * 
	 * Construct a new SimpleTRow instance contains an array of XlsTData.
	 * 
	 * @param data
	 *            contents of the SimpleTRow.
	 * 
	 */

	public SimpleTRow(Object[] data) {

		this.data = new XlsTData[data.length];

		for (int i = 0; i < data.length; i++) {

			if (data[i] instanceof XlsTData) {

				this.data[i] = (XlsTData) data[i];

			} else {

				this.data[i] = new XlsTData(data[i]);

			}

		}

	}

	/**
	 * 
	 * Overloaded constructor.
	 * 
	 * @param data
	 *            content of the SimpleTRow.
	 * 
	 */

	public SimpleTRow(XlsTData data) {

		this.data = new XlsTData[] { data };

	}

	/**
	 * 
	 * Overloaded constructor.
	 * 
	 * 
	 * 
	 * @param str
	 *            the instance contains a XlsTData with this String value.
	 * 
	 */

	public SimpleTRow(String str) {

		this(new XlsTData[] { new XlsTData(str) });

	}

	/**
	 * 
	 * Inherited from XlsTRow.
	 * 
	 * 
	 * 
	 * @return contents of the SimpleTRow.
	 * 
	 */

	public Object[] getXlsContents() {

		return new Object[] { data };

	}

}
